$(function(){
		$('.yve').on('click','.recharge',function(){
		$('.suoding').css('display','block');
		$('.suoding').css({
			"position" : "fixed",
			top :"0px",
			left: "0px"
		});
	})
	$('.suoding').on('click','.cancel',function(){
		$('.suoding').css('display','none')
		
	})
		$(".chongzhi").on('click',".czl",function(){
			var sum = $('.sum').val();
			if (sum == "") {
				return;
			}else {
				layer.confirm('确认充值?',{icon: 0, title:'提示'}, function(index){
					$.post("user/record",{
						sum:sum,
					},function(data){
						layer.msg(data);
						window.location.reload();
					});
					 layer.close(index);
				});
			};
		});
});
$(function(){
	//判断是否有记录
	if ($('.user .qq td').text()=='') {
		$('.wudanimg').css('display','block')
	}
	
	/**
	 * 分页
	 */
	$(".M-box").pagination({
        showData:13,
        totalData: $('.user .user-title').attr('data-AllCount'),
        coping:true,
        homePage:'首页',
        endPage:'末页',
        prevContent:'上页',
        nextContent:'下页',
        callback:function(api){
        	console.log("当前页："+api.getCurrent());
    		console.log("总页："+api.getPageCount());
        	$.post('user/record',{
        		Current:api.getCurrent()
        	},function(data){
        		$('.qq tbody').html("");
        		console.log(data);
        		$.each(JSON.parse(data), function(i, item) {
        			console.log(item.urMoney+item.urDate)
        			var td1=$("<td>").text(item.urMoney);
        			var td2=$("<td>").text(getMyDate(item.urDate));
        			var td3=$("<td>").text(item.urWay);
        			var tr=$("<tr>").append(td1).append(td2).append(td3);
        			$('.qq tbody').append(tr);
        		});
        		$(".user table>tbody>tr:even").css("background", "#fff");
        		$(".user table>tbody>tr:odd").css("background", "#f9f9f9");
        	});
        }
	});
	 //美化表格
	$(".user table>tbody>tr:even").css("background", "#fff");
	$(".user table>tbody>tr:odd").css("background", "#f9f9f9");
});
//格式化时间
 function getMyDate(str){  
    var oDate = new Date(str),  
    oYear = oDate.getFullYear(),  
    oMonth = oDate.getMonth()+1,  
    oDay = oDate.getDate(),  
    oHour = oDate.getHours(),  
    oMin = oDate.getMinutes(),  
    oSen = oDate.getSeconds(),  
    oTime = oYear +'-'+ getzf(oMonth) +'-'+ getzf(oDay) +' '+ getzf(oHour) +':'+ getzf(oMin) +':'+getzf(oSen);//最后拼接时间  
    return oTime;  
}; 
//补0操作  
function getzf(num){  
    if(parseInt(num) < 10){  
        num = '0'+num;  
    }  
    return num;  
}  